package com.SmartCare.controller.manager;

import com.SmartCare.common.Result;
import com.SmartCare.pojo.message.MsgBindCareHome;
import com.SmartCare.service.message.MsgBindCareHomeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 绑定养老院消息表 前端控制器
 */
@RestController
@RequestMapping("/msg-bind-care-home")
public class MsgBindCareHomeController {

    @Resource
    private MsgBindCareHomeService msgBindCareHomeService;

    //根据养老院名获取消息列表
    @GetMapping("/query-by-name")
    public Result queryByName(@RequestParam String name){
        return msgBindCareHomeService.query(name);
    }

    @PutMapping("/update")
    public Result update(@RequestBody MsgBindCareHome msg) {
        return msgBindCareHomeService.updateMsg(msg);
    }

    @PostMapping("/send-request")
    public Result sendRequest(@RequestParam String careHomeName, @RequestParam Long userId) {
        return msgBindCareHomeService.addNewMsg(careHomeName, userId);
    }
}

